package com.wdciti.sccp.iot.springvertx.protocols.tcp.ext;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.vertx.core.impl.VertxInternal;
import io.vertx.core.net.NetServerOptions;
import io.vertx.core.net.impl.NetServerImpl;

/**
 * @author by early
 * @blame IOT Team
 * @date 2020/06/01.
 */
public class FrameNetServerImpl extends NetServerImpl {

    private final ChannelHandler channelHandler;

    public FrameNetServerImpl(VertxInternal vertx, NetServerOptions options, ByteToMessageDecoder decoder) {
        super(vertx, options);
        this.channelHandler = decoder;
    }

    @Override
    public void initChannel(ChannelPipeline pipeline, boolean ssl) {
        super.initChannel(pipeline, ssl);
        if (channelHandler != null) {
            pipeline.addLast(channelHandler);
        }
    }

}
